//Tue Apr 26 09:35:09 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class Algrid {
public:
	vector<string> makeProgram(vector<string> output) {
		int H = output.size();
		int W = output[0].size();
		for (int i = H - 2; i >= 0; i--) {
			for (int j = W - 2; j >= 0; j--) {
				if (output[i][j] == 'B' && output[i][j + 1] == 'W') {
					if (output[i + 1][j] == 'W' || output[i + 1][j + 1] == 'W')
						return vector<string> (0);
					else {
						output[i + 1][j] = '?';
						output[i + 1][j + 1] = '?';
					}
				} else if (output[i][j] == 'W' && output[i][j + 1] == 'B') {
					if (output[i + 1][j] == 'B' || output[i + 1][j + 1] == 'B')
						return vector<string> (0);
					else {
						output[i + 1][j] = '?';
						output[i + 1][j + 1] = '?';
					}
				} else if (output[i][j] == 'B' && output[i][j + 1] == 'B') {
					char tmp = output[i + 1][j];
					output[i + 1][j] = output[i + 1][j + 1];
					output[i + 1][j + 1] = tmp;
				}
			}
			replace(output[i + 1].begin(), output[i + 1].end(), '?', 'B');
		}
		return output;
	}
};

